package com.xiaobange.utils;

import lombok.Getter;

/**
 * @version 1.0
 * @Author 小班哥
 * @Date 2025/4/26 13:39
 * @Explain 统一响应状态码
 */
@Getter
public enum ResponseCodeEnum {

    // 成功类
    SUCCESS(200, "SUCCESS"),//操作成功
    CREATED(201, "Resource creation successful"),//资源创建成功
    NOT_PROCESSED(202,"The request has been accepted, but it has not been processed yet"),//已经接受请求，但未处理完成
    NO_CONTENT(204, "successful but no return content"),//请求成功但无返回内容

    // 客户端错误类
    PARAM_ERROR(400, "parameter error"),//参数错误
    PARAM_MISSING(400, "Missing parameter"),//参数缺失
    UNAUTHORIZED(401, "未授权，请先登录"),
    FORBIDDEN(403, "权限不足，拒绝访问"),
    NOT_FOUND(404, "请求的资源不存在"),
    CONFLICT(409, "资源冲突，请检查后重试"),

    // 服务端错误类
    SERVER_ERROR(500, "服务器内部错误"),
    BAD_GATEWAY(502, "网关错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用，请稍后重试"),
    GATEWAY_TIMEOUT(504, "网关超时，请稍后重试");

    private final int code;
    private final String message;

    ResponseCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }
}